﻿<UserControl x:Class="TechNewLogic.GraphIT.Hv.Legend.TileControl"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
		xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
		xmlns:Core="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"
		mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300" x:Name="root"
		x:ClassModifier="internal">

	<UserControl.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="/TechNewLogic.GraphIT;component/Styles/RoundButton.xaml" />
			</ResourceDictionary.MergedDictionaries>
		</ResourceDictionary>
	</UserControl.Resources>

	<VisualStateManager.CustomVisualStateManager>
		<Core:ExtendedVisualStateManager />
	</VisualStateManager.CustomVisualStateManager>

	<VisualStateManager.VisualStateGroups>
		<VisualStateGroup x:Name="CommonStates">
			<VisualState x:Name="Normal" />
			<VisualState x:Name="Selected">
				<Storyboard>
					<ColorAnimation Storyboard.TargetName="curveColorRect"
							Storyboard.TargetProperty="OpacityMask.GradientStops[0].Color"
							To="Black" Duration="0:0:0.15" />
					<ColorAnimation Storyboard.TargetName="curveColorRect"
							Storyboard.TargetProperty="OpacityMask.GradientStops[1].Color"
							To="Black" Duration="0:0:0.15" />
					<DoubleAnimation Storyboard.TargetName="curveColorRect"
							Storyboard.TargetProperty="Opacity" To="0.7" Duration="0:0:0.15" />
				</Storyboard>
			</VisualState>
			<VisualState x:Name="Invisible">
				<Storyboard>
					<ObjectAnimationUsingKeyFrames Storyboard.TargetName="curveColorRect"
							Storyboard.TargetProperty="Visibility" Duration="0:0:0.15">
						<DiscreteObjectKeyFrame Value="{x:Static Visibility.Collapsed}" />
					</ObjectAnimationUsingKeyFrames>
				</Storyboard>
			</VisualState>
		</VisualStateGroup>
	</VisualStateManager.VisualStateGroups>

	<Grid DataContext="{Binding ViewModel, ElementName=root}" MouseEnter="ContentControl_MouseEnter"
			MouseLeave="ContentControl_MouseLeave"
			MouseLeftButtonDown="ContentControl_MouseLeftButtonDown">

		<Border BorderBrush="Gray" BorderThickness="0.5">
			<Grid>
				<Grid.Background>
					<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
						<GradientStop Color="#50ffffff" Offset="0" />
						<GradientStop Color="#20ffffff" Offset="1" />
					</LinearGradientBrush>
				</Grid.Background>
				<Rectangle x:Name="curveColorRect">
					<Rectangle.Fill>
						<SolidColorBrush Color="{Binding Stroke}" />
					</Rectangle.Fill>
					<Rectangle.OpacityMask>
						<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
							<GradientStop Color="#90000000" Offset="0" />
							<GradientStop Color="#20000000" Offset="1" />
						</LinearGradientBrush>
					</Rectangle.OpacityMask>
				</Rectangle>
				<Rectangle x:Name="overlay" Fill="White" Opacity="0.1" RadiusX="3" RadiusY="3" />
				<DockPanel HorizontalAlignment="Left">

					<!-- Current Value -->
					<StackPanel DockPanel.Dock="Left" Width="120" VerticalAlignment="Center"
							Margin="2,1,0,1">
						<DockPanel HorizontalAlignment="Center">
							<TextBlock FontSize="20" FontWeight="Bold" Text="{Binding CurrentValue}" />
							<TextBlock Text="{Binding Uom}" Margin="2,9,0,0" />
						</DockPanel>
					</StackPanel>

					<Border BorderBrush="#50000000" BorderThickness="0.5" DockPanel.Dock="Left"
							Margin="5,2" />

					<!-- Curve Description Texts -->
					<UniformGrid Rows="2" Margin="0,1">
						<TextBlock Text="{Binding Description1}" Margin="0,-1"
								TextTrimming="CharacterEllipsis" />
						<TextBlock Text="{Binding Description2}" Margin="0,-1"
								TextTrimming="CharacterEllipsis" />
						<!--<TextBlock Text="{Binding Description3}"
										TextTrimming="CharacterEllipsis" />
								<TextBlock Text="{Binding Description4}"
										TextTrimming="CharacterEllipsis" />-->
					</UniformGrid>

				</DockPanel>
			</Grid>
		</Border>
	</Grid>

</UserControl>
